const commander = require('commander')

const implementation = require('@/core/implementation.js')

function commandInit() {
    const init = new commander.Command('init')
    init.action(implementation.init)
    return init
}

function commandList() {
    const list = new commander.Command('list')
    list.action(implementation.list)
    return list
}

function commandStatus() {
    const status = new commander.Command('status')
    status.action(implementation.status)
    return status
}

function commandSync() {
    const sync = new commander.Command('sync')
    sync.action(implementation.sync)
    return sync
}

module.exports = function main(argv) {
    commander
        .version('0.0.3')
        .addCommand(commandInit())
        .addCommand(commandList())
        .addCommand(commandStatus())
        .addCommand(commandSync())
        .parse(argv)
}
